﻿Imports b3t.CardGameFramework

Public Class TarotGame
#Region "Fields"

    'Deck and Player objects for the current deck, dealer, and player
    Public _deck As Deck
    Public _You As Player
    Public _West As Player
    Public _East As Player
#End Region

#Region "Properties"

    Public ReadOnly Property CurrentDeck() As Deck
        Get
            Return _deck
        End Get
    End Property
#End Region

#Region "Main Game Constructor"

    ''' <summary>
    ''' Main Constructor
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New()
        ' Create players
        _You = New Player
        _West = New Player
        _East = New Player
    End Sub
#End Region

#Region "Game Methods"

    ''' <summary>
    ''' Deals a new game.
    ''' </summary>
    ''' <remarks>This is invoked through the Deal button in BlackJackForm.vb</remarks>
    Public Sub DealNewGame()

        'Create a new deck and then shuffle the deck
        _deck = New Deck
        _deck.Shuffle()

        'Reset the player hands in case this is not the first game
        _You.NewHand()
        _West.NewHand()
        _East.NewHand()

        'Deal cards to each person's hand
        Dim i As Integer = 0
        While i < 24
            Dim c As Card = _deck.Draw
            _You.Hand.Cards.Add(c)
            Dim d As Card = _deck.Draw
            _West.Hand.Cards.Add(d)
            Dim e As Card = _deck.Draw
            _East.Hand.Cards.Add(e)
            i = i + 1
        End While

        'Give the players a handle to the current deck
        _You.CurrentDeck = _deck
        _West.CurrentDeck = _deck
        _East.CurrentDeck = _deck

    End Sub


#End Region

End Class

